package cn.edu.scau.cmi.chenjieling.singleton;

public class Singleton {
    private static volatile Singleton singleton;
    private String name;
    private Singleton(String name){
        this.name=name;
    }
    public  static Singleton getInstance(String name){
        if(singleton==null){
            synchronized(Singleton.class){
                if(singleton==null){
                    singleton=new Singleton(name);
                }
            }
        }
        return singleton;
    }
    
    public String getName(){
        return this.name;
    }
    
    public void setName(String name){
        this.name=name;
    }
}
